package com.lei2j.dubbo.producer.service.impl;

import com.lei2j.dubbo.service.DemoService;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.config.annotation.Service;

/**
 * author: leijinjun
 * date: 2019/7/3
 */
//使用指定协议
//使用多协议暴露服务，需先定义
//cache结果缓存，lru:最近最少使用删除缓存，保存热点数据
@Service(group = "group1",methods = {@Method(name = "say",timeout = 1000,cache = "lru")})
public class DemoServiceImpl implements DemoService {

    @Override
    public Object attach() {
        return null;
    }

    @Override
    public String say(String name) {
        System.out.println("rpc:"+name);
//        int i = 1/0;
        return "hello:" + name;
    }

    @Override
    public String concurrent(String name) {
        return null;
    }
}